//
//  LGCover.m
//  微博
//
//  Created by MS on 15-12-4.
//  Copyright (c) 2015年 MS. All rights reserved.
//

#import "LGCover.h"

@implementation LGCover

-(void)setBackgrondAlph:(BOOL)backgrondAlph
{
    _backgrondAlph = backgrondAlph;
    
    if (backgrondAlph) {
        
        self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.2;
    }
    else
    {
        self.backgroundColor = [UIColor clearColor];
        self.alpha = 1;
    }
}

+(instancetype)show
{
    LGCover * cover = [[self alloc] initWithFrame:LGKeyWindow.bounds];
    
    cover.backgroundColor = [UIColor clearColor];
    
    [LGKeyWindow addSubview:cover];
    
    return cover;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    
    [self removeFromSuperview];
    
    if ([self.delegate respondsToSelector:@selector(coverDidClick:)]) {
        
        [self.delegate coverDidClick:self];
    }
}




@end
